import Redis from "ioredis";
const StoreConfig = require("../config/store.json");
let RedisClient: Redis.Redis | null = null;
const NODE_ENV = process.env.NODE_ENV || "development";
const redisConfig = StoreConfig[NODE_ENV]["redis"];
export function getRedisClient(): Redis.Redis {
  if (RedisClient) {
    return RedisClient;
  }
  RedisClient = new Redis(redisConfig);
  return RedisClient;
}
